<?php
/* 
 * @author Jens Beyer
 * @date 04-07-2012
 */
require_once 'System.php';
require_once 'PHPUnit/Autoload.php';
require_once('D:/Programme/Xampp/htdocs/Game/includes/GetFiles.php');
class TestIndex extends PHPUnit_Framework_TestCase
{
    public function testGetFiles()
    {
        $getFiles = $this->getMock('GetFiles', array('getDocumentRoot'));
        $getFiles->expects($this->any())
            ->method('getDocumentRoot')
            ->will($this->returnValue('D:/Programme/Xampp/htdocs/Game/'))
        ;
//        $getFiles = new GetFiles();
        $getFiles->getAllGaleriaFiles();
        $this->assertGreaterThan(0, count($getFiles->getFiles()));
    }

    public function getPostDecision($identifier)
    {
        switch ($identifier) {
            case 'logName':
                return 'checker';
                break;
            case 'logPass':
                return 'user20';
                break;
            default:
                return 'nothing';
                break;
        }
    }
//    public function
    public function Login() {
//        function callback() {return array('action' => 'login');}
        $login = $this->getMock('Login', array('getRequest','getPost'));
        $login->expects($this->at(0))
            ->method('getRequest')
            ->with('action')
            ->will($this->returnValue('login'))
        ;
        $login->expects($this->any())
            ->method('getPost')
//            ->with('logName')
            ->will($this->returnCallback(array($this, 'getPostDecision')))
        ;
//        $login->expects($this->at(0))
//            ->method('getPost')
//            ->with('logPass')
//            ->will($this->returnValue('user20'))
//        ;
        $login->loginUser();
        print_r($login->getUserData());
//        var_dump($login->getRequest());
    }


}
$suite = new PHPUnit_Framework_TestSuite('TestIndex');
PHPUnit_TextUI_TestRunner::run($suite);
